package com.cincc.cinccimdemo.viewholder;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.cincc.cinccimdemo.R;
import com.cincc.cinccimdemo.adapter.ConversationAdapter;
import com.cincc.cinccimdemo.common.Constants;
import com.cincc.cinccimdemo.model.MessageInfo;
import com.cincc.cinccimdemo.model.MessageInfoUI;
import com.cincc.im.model.enums.ImSendType;

public class RecallHolder extends MessageContentHolder {

    TextView textView;
    TextView reeditTextView;

    public RecallHolder(Context context, View itemView, ConversationAdapter adapter) {
        super(context, itemView, adapter);
        textView = itemView.findViewById(R.id.message_tv);
//        reeditTextView = itemView.findViewById(R.id.reeditTextView);
    }

    @Override
    public void bindView(MessageInfoUI uiMessage, int position) {
        MessageInfo messageEntity = uiMessage.getMessageInfo();

        if (ImSendType.isP2P(uiMessage.getMessageInfo().imSendType)) {
            if (messageEntity.senderId.equals(Constants.userInfo.userId)) {
                textView.setText("您撤回了一条消息");
            } else {
                textView.setText("对方撤回了一条消息");
            }
        } else {
            if (messageEntity.senderId.equals(Constants.userInfo.userId)) {
                textView.setText("您撤回了一条消息");
            } else {
                textView.setText(messageEntity.senderName + "撤回了一条消息");
            }
        }

//        reeditTextView.setOnClickListener(v -> {
//
//        });
    }
}
